// 学校的建立，最基本对象
class School {
    String name = ''
    Date start = new Date()
    Date end = new Date()
    String person = '' //联系人
    String tel = ''
    String subDomain = ''
    String domain = ''
    boolean enable = true //是否启用
    SchoolInfo schoolInfo 
    static hasMany = [level : String]
    //  地区
    String area

//    static belongsTo = [schoolInfo:SchoolInfo]

    static constraints = {
		name(blank: false, size:0..250)
		person(blank: true, size:0..250)
		tel(blank: true, size:0..500)
 		start()
        end()
        subDomain(nullable:false,blank:false)
        area(nullable:true,blank:true)
        domain(nullable:false,blank:false)
        schoolInfo unique:true  , nullable:true
    }

    static mapping = {
       table 'xedu_school'
       end column:'end_time' 
    }

    String toString (){
        "$name ${end.format('yyyy/MM/dd')}"
    }
}
